import unittest, time
from TestMySplice import TestMySplice
from TestMyAllNum import TestMyAllNum
from HTMLTestRunner import HTMLTestRunner

if __name__ == '__main__':
    suite = unittest.TestSuite()
    # TestLoader后面一定要加括号
    testCase01 = unittest.TestLoader().loadTestsFromTestCase(TestMySplice)
    testCase02 = unittest.TestLoader().loadTestsFromTestCase(TestMyAllNum)
    suite.addTests(tests=testCase01)
    suite.addTests(tests=testCase02)
    # 获取当前时间
    now = time.strftime('%Y-%m-%d %H_%M_%S')
    filename = now + ' report.html'
    fp = open(filename, 'wb')
    # 配置运行参数
    runner = HTMLTestRunner(stream=fp, title='测试报告', description='执行情况')
    runner.run(suite)
    fp.close()
